public class primenumber {
    public primenumber() {
          }

    public static void main(String[] args) {
            int c=0,i;
    for(int n=0;n<=20000;n++){
        
        for(i=2;i<=n-1;i++){
            if(n%i==0) break;
        }
        if(n==i){ 
            System.out.print(n+" ");
            c++;
            if(c%8==0)
                System.out.println();
        }
    }
    }
}
